﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace QuanLyNhaSach.DataAccessLayer
{
    class QuyDinhDAO
    {
        DataConnection dt_con = new DataConnection();
        public QuyDinhDAO() { }

        public void ThemQuyDinh(int notoida, int luongtonban, int luongtonnhap, int nhaptoithieu, bool quydinh4)
        {
            string cmd = "exec QUYDINH_Insert {0},{1},{2},{3},'{4}'";
            dt_con.Write(String.Format(cmd, notoida, luongtonban, luongtonnhap, nhaptoithieu, quydinh4.ToString()));
        }

        public DataTable LayQuyDinh()
        {
            return dt_con.Read("exec QUYDINH_Get");
        }

        public void ThayDoiQuyDinh(int notoida, int luongtonban, int luongtonnhap, int nhaptoithieu, bool quydinh4)
        {
            string cmd = "exec QUYDINH_Update {0},{1},{2},{3},'{4}'";
            dt_con.Write(String.Format(cmd, notoida, luongtonban, luongtonnhap, nhaptoithieu, quydinh4.ToString()));
        }
    }
}
